package com.zhanglu.authentication.service;

import com.zhanglu.authentication.entity.AuthUser;
import com.zhanglu.authentication.mapper.UserMapper;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zhanglu
 */
@Service
@Slf4j
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public AuthUser getUserByUsername(@NonNull String username) {
        return userMapper.selectOne(new AuthUser().setUsername(username));
    }

    public AuthUser getUserById(long id) {
        return userMapper.selectByPrimaryKey(id);
    }
}
